import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {ServiceType, ServiceTypePageResult, ServiceTypeQuery} from "@/api/service-all-type/types";

/**
 * 服务类型分页列表
 *
 * @param queryParams
 */
export function listServiceAllTypePages(
  queryParams?: ServiceTypeQuery
): AxiosPromise<ServiceTypePageResult> {
  return request({
    url: '/web/casualServiceType/broadCategoryPages',
    method: 'get',
    params: queryParams,
  });
}

export function serviceAllTypeAdd(data: any): AxiosPromise<ServiceTypePageResult> {
  return request({
    url: '/web/casualServiceType/broadCategoryadd',
    method: 'post',
    data: data,
  });
}

export function serviceAllTypeDelete(id: number): AxiosPromise<any> {
  return request({
    url: '/web/casualServiceType/broadCategorydel',
    method: 'get',
    params: {id: id}
  });
}

export function serviceAllTypeUpdate(data: ServiceType): AxiosPromise<any> {
  return request({
    url: '/web/casualServiceType/broadCategoryedit',
    method: 'post',
    data: data,
  });
}

export function getServiceTypeForm(id: number): AxiosPromise<ServiceType> {
  return request({
    url: '/web/casualServiceType/queryById',
    method: 'get',
    params: {id: id}
  });
}

export function listServiceTypeOptions(): AxiosPromise<OptionType[]> {
  return request({
    url: '/web/casualServiceType/options',
    method: 'get',
  });
}
